
const kit = {

pickerOptions : {
    shortcuts: [{
        text: '最近一周',
        onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
        }
    }, {
        text: '最近一个月',
        onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
        }
    }, {
        text: '最近三个月',
        onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
        }
    }]
},

    encData(data) {
        // 密钥和向量
        const key = CryptoJS.enc.Utf8.parse('1234567890123456')
        const iv = CryptoJS.enc.Utf8.parse('abcdehijklopqrst')
        // 返回加密结果
        return CryptoJS.AES.encrypt(data, key, {
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.Pkcs7
        }).toString()
    },

    async createStar(starts) {
        const star = document.createElement('div');
        star.className = 'star';
        // 随机位置
        star.style.top = Math.random() * 100 + '%';
        star.style.left = Math.random() * 100 + '%';
        // 随机大小
        const size = Math.random() * 2;
        star.style.width = size + 'px';
        star.style.height = size + 'px';
        // 随机闪烁
        star.style.animation = `twinkle ${Math.random() * 3 + 1}s infinite`;
        stars.appendChild(star);
    },

    // 创建流星的函数
    async createShootingStar(shootingStars) {
        const star = document.createElement('div');
        star.className = 'shooting-star';

        // 随机位置
        star.style.top = `${Math.random() * 100}%`;
        star.style.left = `${Math.random() * 100}%`;

        // 随机动画时长和延迟
        const duration = Math.random() * 2 + 2; // 2-4秒
        const delay = Math.random() * 10; // 0-10秒延迟

        star.style.setProperty('--duration', `${duration}s`);
        star.style.setProperty('--delay', `${delay}s`);

        shootingStars.appendChild(star);

        return star;
    },

    async refreshStar() {
        const stars = document.querySelectorAll('.shooting-star');
        stars.forEach(star => {
            if (!star.style.getPropertyValue('--refreshing')) {
                star.style.top = `${Math.random() * 100}%`;
                star.style.left = `${Math.random() * 100}%`;
                star.style.setProperty('--refreshing', 'true');

                setTimeout(() => {
                    star.style.removeProperty('--refreshing');
                }, parseFloat(star.style.getPropertyValue('--duration')) * 1000);
            }
        });
    },

} ;